package javaer.dev.manual.depthclone;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

/**
 * @author xiaoming
 * @date 2020-11-15 12:32
 */
public class JdkSerialUtil {
    public static <T> T readObject(ByteArrayInputStream inputStream) throws IOException, ClassNotFoundException {
        // 对象输入流
        ObjectInputStream objectInputStream = new ObjectInputStream(inputStream);
        return (T) objectInputStream.readObject();
    }
}
